<template>
  <div class="input-auto-complete">
    <el-input
        v-model="input"
        :placeholder="placeholder"
        style="width: 250px"
        clearable
        @clear="init"
        @keyup.enter.native="init"
    >
      <i
          slot="prefix"
          class="el-input__icon el-icon-search"
          style="cursor: pointer"
          @click="init"
      />
    </el-input>
  </div>
</template>

<script>
export default {
  name: 'InputAutoComplete',
  props: {
    data: {
      type: Array,
      default: () => []
    },
    placeholder: {
      type: String,
      default: ''
    },
    ObKey: {
      type: String,
      default: 'name'
    }
  },
  data() {
    return {
      input: ''
    };
  },
  methods: {
    init() {
      this.$emit('init', this.input);
    }
  }
};
</script>

<style scoped>
.input-auto-complete {
  display: inline-block;
}
</style>